package com.qike.duola.enums;

import com.qike.duola.vo.EnumList;

import java.util.ArrayList;
import java.util.List;

/**
 * 订单状态枚举
 * 运输单状态 1 待装料 2 运输中 3 装料完成 4 到达工地 5 浇筑中 6 回程中 7 退料回程中 8 运输完成
 */
public enum TransOrderStatusEnums {
    WAIT_LOAD                  (1,"待装料"),
    TRANS_ING                      (2,"运输中"),
    LOAD_FINISH                     (3,"装料完成"),
    ARRIVAL_SITE                     (4 ,"到达工地"),
    POUR_ING                     (5 ,"浇筑中"),
    BACK                     (6 ,"回程中"),
    RETURN_BACK                     (7 ,"退料回程中"),
    WAIT_WEIGH                     (8 ,"待过磅"),
    FINISH                     (9 ,"运输完成"),
    ;
    private Integer ecode;

    private String emsg;

    TransOrderStatusEnums(Integer ecode, String emsg) {
        this.ecode = ecode;
        this.emsg = emsg;
    }

    public Integer getEcode() {
        return ecode;
    }

    public String getEmsg() {
        return emsg;
    }

    public static TransOrderStatusEnums statOf(Integer ecode) {
        for (TransOrderStatusEnums state : values())
            if (state.getEcode().equals(ecode))
                return state;
        return null;
    }


    public static List<EnumList> getEnumList(){
        List<EnumList> lists = new ArrayList<>();
        for (TransOrderStatusEnums state : values()){
            EnumList enumList = new EnumList();
            enumList.setKey(state.getEcode());
            enumList.setValue(state.getEmsg());
            lists.add(enumList);
        }
        return lists;
    }
}
